package com.ruoyi.club.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.club.domain.ClubUserProfile;
import com.ruoyi.club.service.IClubUserProfileService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 用户兴趣性格扩展Controller
 * 
 * @author Zou
 * @date 2025-11-14
 */
@RestController
@RequestMapping("/club/profile")
public class ClubUserProfileController extends BaseController
{
    @Autowired
    private IClubUserProfileService clubUserProfileService;

    /**
     * 查询用户兴趣性格扩展列表
     */
    @PreAuthorize("@ss.hasPermi('club:profile:list')")
    @GetMapping("/list")
    public TableDataInfo list(ClubUserProfile clubUserProfile)
    {
        startPage();
        List<ClubUserProfile> list = clubUserProfileService.selectClubUserProfileList(clubUserProfile);
        return getDataTable(list);
    }

    /**
     * 导出用户兴趣性格扩展列表
     */
    @PreAuthorize("@ss.hasPermi('club:profile:export')")
    @Log(title = "用户兴趣性格扩展", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ClubUserProfile clubUserProfile)
    {
        List<ClubUserProfile> list = clubUserProfileService.selectClubUserProfileList(clubUserProfile);
        ExcelUtil<ClubUserProfile> util = new ExcelUtil<ClubUserProfile>(ClubUserProfile.class);
        util.exportExcel(response, list, "用户兴趣性格扩展数据");
    }

    /**
     * 获取用户兴趣性格扩展详细信息
     */
    @PreAuthorize("@ss.hasPermi('club:profile:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(clubUserProfileService.selectClubUserProfileById(id));
    }

    /**
     * 新增用户兴趣性格扩展
     */
    @PreAuthorize("@ss.hasPermi('club:profile:add')")
    @Log(title = "用户兴趣性格扩展", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ClubUserProfile clubUserProfile)
    {
        return toAjax(clubUserProfileService.insertClubUserProfile(clubUserProfile));
    }

    /**
     * 修改用户兴趣性格扩展
     */
    @PreAuthorize("@ss.hasPermi('club:profile:edit')")
    @Log(title = "用户兴趣性格扩展", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ClubUserProfile clubUserProfile)
    {
        return toAjax(clubUserProfileService.updateClubUserProfile(clubUserProfile));
    }

    /**
     * 删除用户兴趣性格扩展
     */
    @PreAuthorize("@ss.hasPermi('club:profile:remove')")
    @Log(title = "用户兴趣性格扩展", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(clubUserProfileService.deleteClubUserProfileByIds(ids));
    }
}
